<template>
  <div>
    <van-sticky>
      <van-dropdown-menu active-color="#1989fa" v-if="orderId !== '-1'">
        <van-dropdown-item v-model="value" :options="option" />
      </van-dropdown-menu>
    </van-sticky>
    <div v-if="orderId === '-1'">
      <orderAddOrUpdate ref="orderAddOrUpdate" :isRenewal="isRenewal"></orderAddOrUpdate>
    </div>
    <div v-else>
      <orderAddOrUpdate
        ref="orderAddOrUpdate"
        v-if="value === 0"
        :isRenewal="isRenewal"
      ></orderAddOrUpdate>
      <orderTrace ref="orderTrace" v-if="value === 1"></orderTrace>
      <orderRegister ref="orderRegister" v-if="value === 2"></orderRegister>
      <orderClear ref="orderClear" v-if="value === 3"></orderClear>
    </div>
  </div>
</template>

<script>
import orderAddOrUpdate from "./orderAddOrUpdate.vue";
import orderTrace from "./orderTrace";
import orderRegister from "../../orderRegister/mobile/index.vue";
import orderClear from "../../orderClear/mobile/index.vue";
export default {
  name: "OrderAdd",
  components: { orderAddOrUpdate, orderTrace, orderRegister, orderClear },
  data() {
    return {
      value: 0,
      option: [
        { text: "项目信息", value: 0 },
        { text: "拜访记录", value: 1 },
        { text: "项目立项", value: 2 },
        { text: "项目结算", value: 3 },
      ],
      orderId: "",
    };
  },
  created() {
    this.orderId = this.$route.params.orderId;
    this.isRenewal = this.$route.query.isRenewal;
  },
  methods: {},
};
</script>

<style scoped>
::v-deep .van-dropdown-menu__bar {
  margin-bottom: 5px;
  box-shadow: none;
}
</style>